
<section  class="hbox stretch">


    <!--<aside class="aside-lg bg-light lter b-r">
        <section class="vbox">
            <section class="scrollable">
                <div class="wrapper">
                    <div class="clearfix m-b">
                        <a href="#" class="pull-left thumb m-r">
                            <?php if ($organisation['Organisation']['logo']) { ?>
                                <img src="<?php echo $this->Html->url($organisation['Organisation']['logo']); ?>" class="img-circle img-thumbnail">
                            <?php } else { ?>
                                <img src="<?php echo $this->Html->url('/img/logo_placeholder.jpg'); ?>" class="img-circle img-thumbnail">
                            <?php } ?>
                        </a>
                        <div class="clear">
                            <div class="h4 m-t-xs m-b-xs"><?php echo $organisation['Organisation']['name']; ?></div>
                            <small class="text-muted"><i class="fa fa-map-marker"></i> <?php echo $organisation['Organisation']['address']; ?></small>
                        </div>                
                    </div>

                    <!--<div class="panel wrapper">
                        <div class="row">
                            <div class="col-xs-4">
                                <a href="#">
                                    <span class="m-b-xs h4 block"><?php //echo $stats['total_members'];     ?></span>
                                    <small class="text-muted">Members</small>
                                </a>
                            </div>
                            <div class="col-xs-4">
                                <a href="#">
                                    <span class="m-b-xs h4 block"><?php //echo $stats['total_males'];     ?></span>
                                    <small class="text-muted">Males</small>
                                </a>
                            </div>
                            <div class="col-xs-4">
                                <a href="#">
                                    <span class="m-b-xs h4 block"><?php //echo $stats['total_females'];     ?></span>
                                    <small class="text-muted">Females</small>
                                </a>
                            </div>
                        </div>
                    </div>



                    <div class="btn-group btn-group-justified m-b">
                        <a class="btn btn-success btn-rounded" data-toggle="button">
                            <span class="text text-white text-sm">
                                <i class="fa fa-eye"></i> Join
                            </span>
                            <span class="text-active text-sm">
                                <i class="fa fa-eye"></i> Joined
                            </span>
                        </a>
                        <a class="btn btn-info btn-rounded text-sm">
                            <i class="fa fa-envelope"></i> Message
                        </a>
                    </div>


                    <div>
                        <small class="text-uc text-xs text-muted">about us</small>
                        <p><?php echo $organisation['OrganisationType']['name']; ?></p>

                        <small class="text-uc text-xs text-muted">contact us</small>
                        <p class="text-xs  m-t-sm  m-l-sm">
                            <i class="fa fa-phone"></i> 
                            <?php echo $organisation['Organisation']['phone']; ?>
                        </p>

                        <p class="text-xs m-l-sm">
                            <i class="fa fa-envelope"></i> 
                            <a href="mailto:<?php echo $organisation['Organisation']['email']; ?>">
                                <?php echo $organisation['Organisation']['email']; ?>
                            </a>
                        </p>

                        <?php if ($organisation['Organisation']['website'] != '') { ?>
                            <p class="text-xs m-l-sm">
                                <i class="fa fa-globe"></i> 
                                <a href="<?php echo $organisation['Organisation']['website']; ?>" target="_blank">
                                    <?php echo $organisation['Organisation']['website']; ?>
                                </a>
                            </p>
                        <?php } ?>

                        <!--
                        TODO: Add social media tables
                        <div class="line"></div>
                        
                        <small class="text-uc text-xs text-muted">connect</small>
                        <p class="m-t-sm text-center">
                            <a href="#" class="btn btn-rounded btn-twitter btn-icon"><i class="fa fa-twitter"></i></a>
                            <a href="#" class="btn btn-rounded btn-facebook btn-icon"><i class="fa fa-facebook"></i></a>
                            <a href="#" class="btn btn-rounded btn-gplus btn-icon"><i class="fa fa-google-plus"></i></a>
                        </p>
                    </div>

                </div>
            </section>
        </section>
    </aside>-->

    <section class='scrollable bg-white b-l b-t b-b'>

        <div class='m-t b-b' style="height: 140px;">
            <div class='col-lg-10'>
                <a href="#" class="pull-left thumb-md m-r">
                    <?php if ($organisation['Organisation']['logo']) { ?>
                        <img src="<?php echo $this->Html->url($organisation['Organisation']['logo']); ?>" class="img-thumbnail">
                    <?php } else { ?>
                        <img src="<?php echo $this->Html->url('/img/logo_placeholder.jpg'); ?>" class="img-thumbnail">
                    <?php } ?>
                </a>

                <p class='font-bold text-success h3'><?php echo $organisation['Organisation']['name']; ?></p>
                <p>
                    <?php echo $organisation['Organisation']['long_description'] != '' ? $organisation['Organisation']['long_description'] : ""; ?>
                </p>
            </div>
            
            <div class='col-lg-2 text-right'>
                <ul class='list-unstyled'>
                    <li class='m-b-sm'>
                        <?php 
                        if( $manage_option ) {
                            $slug = $organisation['Organisation']['slug'];
                            $org_url = $this->Html->url("/member/org_login/$slug");
                            echo "<a href='$org_url' class='org_manage btn btn-sm btn-success' data-toggle='ajaxModal'>Manage</a>";
                        }
                        ?>
                    </li>
                </ul>
            </div>
        </div>

        <div class='b-b bg-light lter'>
            <div class="wrapper">
                <div class="row">
                    <div class="col-lg-4" style="padding-right: 0px;">
                        <div class="panel m-b-none">
                            <div class="panel-body p-sm" style="min-height: 120px; max-height: 150px;">
                                <p class="font-bold text-xs">About Us</p>
                                <div class='col-lg-12 text-sm'>
                                    <div class='row'>
                                        <div class='col-lg-4 p-xs'>
                                            <i class='fa fa-tag'></i> Category: 
                                        </div>
                                        <div class='col-lg-8 p-xs'>
                                            <b><?php echo $organisation['OrganisationType']['name']; ?></b>
                                        </div>
                                    </div>

                                    <div class='row'>
                                        <div class='col-lg-4 p-xs'>
                                            <i class='fa fa-group'></i> Members: 
                                        </div>
                                        <div class='col-lg-8 p-xs'>
                                            <b><?php echo $organisation['Organisation']['members']; ?></b>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="col-lg-4" style="padding-right: 0px;">
                        <div class="panel m-b-none">
                            <div class="panel-body p-sm" style="min-height: 120px; max-height: 150px;">
                                <p class="font-bold text-xs">Mission</p>
                                <p class="text-sm">
                                    <?php echo $organisation['Organisation']['mission']; ?>
                                </p>
                            </div>
                        </div>
                    </div>

                    <div class="col-lg-4">
                        <div class="panel m-b-none">
                            <div class="panel-body p-sm" style="min-height: 120px; max-height: 150px;">
                                <p class="font-bold text-xs">Contact Us</p>
                                
                                <p class="text-xs  m-t-sm  m-l-sm m-b-xs" style='white-space: nowrap; text-overflow: ellipsis;'>
                                    <i class="fa fa-map-marker"></i> 
                                    <?php 
                                        echo $organisation['Organisation']['address'] 
                                            . ( $organisation['Organisation']['city'] != '' ? ', ' . $organisation['Organisation']['city'] : '')
                                            . ($organisation['Organisation']['state'] != '' ? ', ' . $organisation['Organisation']['state']: ''); 
                                    ?>
                                </p>

                                <p class="text-xs  m-l-sm m-b-xs">
                                    <i class="fa fa-phone"></i> 
                                    <?php echo $organisation['Organisation']['phone']; ?>
                                </p>

                                <p class="text-xs m-l-sm m-b-xs">
                                    <i class="fa fa-envelope"></i> 
                                    <a href="mailto:<?php echo $organisation['Organisation']['email']; ?>">
                                        <?php echo $organisation['Organisation']['email']; ?>
                                    </a>
                                </p>

                                <?php if ($organisation['Organisation']['website'] != '') { ?>
                                    <p class="text-xs m-l-sm m-b-xs">
                                        <i class="fa fa-globe"></i> 
                                        <a href="<?php echo $organisation['Organisation']['website']; ?>" target="_blank">
                                            <?php echo $organisation['Organisation']['website']; ?>
                                        </a>
                                    </p>
                                <?php } ?>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div id="members_panel">
            <div class="wrapper">
                <div class="col-lg-l2">
                    <div class="panel">
                        <div class="panel-heading">
                            Members &bull; <span class='text-muted'><?php echo $organisation['Organisation']['members']; ?></span>
                        </div>

                        <div class="panel-body">
                            <div class="row">
                                <?php foreach($members as $member) { ?>
                                <div class='col-lg-4 m-b-sm' style='padding-right: 0px;'>
                                    <span class='col-sm-3' style='padding-right: 0px;'>
                                        <?php 
                                        $default = $this->Html->url('/img/avatar_default.jpg'); 
                                        $url = isset($member['MemberImage'][0]['thumb_url']) ? $member['MemberImage'][0]['thumb_url'] : $default;
                                        ?>
                                        <img src='<?php echo $url ?>' class='thumb img-thumbnail' onerror="this.src = '<?php echo $default; ?>';" />
                                    </span>
                                    <span class='col-sm-9'>
                                        <p class='font-bold text-xs'><?php echo $member['Member']['first_name'] . ' ' . $member['Member']['last_name']; ?></p>
                                        <p class='text-muted text-xs m-t-n-sm'><?php echo $member['Member']['occupation']; ?></p>
                                    </span>
                                </div>
                                <?php } ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </section>

    <aside class="col-lg-3 b-l">
        <section class="vbox">
            <div class="scrollable">
                <div class="wrapper">

                    <div class="h5 font-bold m-b">Featured Organisations</div>



                    <div class="b-t m-b"></div>

                    <div class="panel bg-white">
                        <div class="panel-body">
                            <a href="<?php echo $this->Html->url(array('controller' => 'organisation', 'action' => 'register', 'web' => true)); ?>" class=""><i class="fa fa-plus-square"></i> Setup An Organisation</a> to manage membership data.
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </aside>

</section>

<input type="hidden" id="charts-data-url" value="<?php echo $this->Html->url(array('controller' => 'charts', 'action' => 'member_stats')); ?>" />

<?php
echo $this->Html->script('charts/flot/jquery.flot.min.js');
echo $this->Html->script('charts/flot/jquery.flot.tooltip.min.js');
echo $this->Html->script('charts/flot/jquery.flot.resize.js');
echo $this->Html->script('charts/flot/jquery.flot.orderBars.js');
echo $this->Html->script('charts/flot/jquery.flot.pie.min.js');
echo $this->Html->script('charts/flot/jquery.flot.time.js');
echo $this->Html->script('app/views/organisations/admin_index.js');
?>